 #include<stdio.h>
#include<unistd.h>
int gval = 100;
int main()
{
         pid_t id = fork();
    if(id)
    { 
        while(1)
         {
             printf("父进程，pid:%d,ppid:%d,gval:%d,&gval:%p\n",getpid(),getppid(),gval,&gval);
                sleep(1);
            }
    }
        else 
         {
         while(1)
         {
             printf("子进程，pid:%d,ppid:%d,gval:%d,&gval:%p\n",getpid(),getppid(),gval,&gval);
             sleep(1);
             ++gval;                                                                                                                                               
         }                                                                                                                                                 
   }                                                                                                                                                         
     return 0;                                                                                                                                                 
 } 
